package com.hx.dc.controllor;

import com.hx.dc.entity.OrderModel;
import com.hx.dc.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
@RequestMapping("ordermod")
public class OrderModAction extends BaseAction {

	@Autowired
	private DcEmployeeService dcEmployeeService;

	@Autowired
	private DcCatagotyService dcCatagotyService;

	@Autowired
	private OrderModelService orderModelService;

	@RequestMapping(value = "/ordermodeselect")
	@ResponseBody
	public Object login() {
		return orderModelService.selectList(null);
	}


	@RequestMapping(value = "/selectPage")
	@ResponseBody
	// easyui提交数据：page:1 rows:15
	public Object selectPage(OrderModel orderModel, Integer page, Integer rows) {
		System.out.println("page:" + page + ",rows:" + rows);
		return this.getPage(orderModelService.selectPage(orderModel, page, rows));
	}

	@RequestMapping(value = "/doUse")
	@ResponseBody
	// easyui提交数据：page:1 rows:15
	public Integer doUse(Integer id,OrderModel orderModel) {
		orderModel.setModelId(id);
		orderModelService.updateReset(orderModel);
		return orderModelService.update(orderModel);
	}
}
